package com.company.dao;

import com.company.entity.Accounts;

public class AccountsDao extends BaseDao<Accounts> {
	Accounts accounts;

	public Accounts getAccounts() {
		return accounts;
	}

	public void setAccounts(Accounts accounts) {
		this.accounts = accounts;
	}

	public String query() {
		String sql = "from Accounts";
		return queryEntiy(sql).getUsername();
	}


	public Accounts list() {
		String sql = "from Accounts";
		return queryEntiy(sql);
	}

	public boolean login(String username, String password) {
		String sql = "from Accounts where username = ?";
		Accounts t = queryEntiy(sql, username);
		if (t == null) {
			return false;
		}
		if (t.getPassword().equals(password)) {
			return true;
		}
		return false;
	}

	public void update(Accounts accounts) {
		super.update(accounts);
	}
}
